<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script th:src="@{/common/jquery/jquery.js}"></script>
    <link th:href="@{/common/layui-new/layui/css/layui.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/common/layui/admin.css}" rel="stylesheet" type="text/css"/>
    <script th:src="@{/common/layui-new/layui/layui.js}"></script>
</head>
<body>
    <textarea id="demo" style="display: none;"></textarea>
    <button type="button" class="layui-btn layui-btn-radius" onclick="submit()" style="position: absolute;right: 20px">提交</button>
</body>

<script type="text/javascript">
    var index;
    var layedit
    layui.use('layedit', function(){
        layedit = layui.layedit;
        index=layedit.build('demo',{
            tool:['strong' //加粗
                ,'italic' //斜体
                ,'underline' ]
        }); //建立编辑器
    });
    function submit() {
        var content=layedit.getText(index);
        // var name = [[${name}]];
        $.ajax({
            url:"http://192.168.56.1:8888/ws/addcomment",
            type:"post",
            data: {name:"1_1",comment:content},
            success:function (data) {
                var frameIndex = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(frameIndex);
            }
        });
        parent.layer.tips('提交成功', '#parentIframe', {time: 3000});
        parent.layer.close(index);
    }
</script>
</html>